package cc.vv.btpartyjob.delegate

import android.text.TextUtils
import android.widget.EditText
import android.widget.TextView
import cc.vv.btpartyjob.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 登录视图托管类
 * Created by sun.li on 2018/10/24.
 */
class LoginActivityDelegate : BaseAppDelegate() {

    override fun initWidget() {
    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_login
    }

    /**
     * 设置手机号
     */
    fun setPhone(telPhone: String) {
        val inputTelPhone = getView<TextView>(R.id.et_login_passport)
        inputTelPhone.text = telPhone
        if (!TextUtils.isEmpty(telPhone)) {
            val etPhone = getView<EditText>(R.id.et_login_passport)
            etPhone.setSelection(telPhone.length)
        }
    }


    /**
     * 获取用户名手机号
     */
    fun getPhoneNum(): String {
        val phone = getView<TextView>(R.id.et_login_passport)
        return phone?.text.toString().trim()
    }

    /**
     * 获取密码
     */
    fun getPassWord(): String {
        val passWord = getView<TextView>(R.id.et_login_password)
        return passWord?.text.toString().trim()
    }


}